package com.xindao.other;

import java.util.UUID;

import android.telephony.TelephonyManager;
import android.text.TextUtils;

public class PhoneUtil {

  public static String getDeviceId(TelephonyManager tm) {

    String id = tm.getSubscriberId();
    if (TextUtils.isEmpty(id)) {
      id = tm.getDeviceId();
    } else if (TextUtils.isEmpty(id)) {
      id = UUID.randomUUID().toString();
    }
    return id;

  }

}
